feat: add Verifier::set_provider and Verifier::with_provider#81
feat: add Verifier::set_provider and Verifier::with_provider#81cpu merged 1 commit intorustls:mainfrom jbr:verifier-set-provider-and-with-provider
Conversation
|
Thank you for picking this up! The general approach seems like the right solution. |
|
Hi Everyone! Thanks @jbr for picking this up so fast, I'm not sure what type of testing you have done but I tried to verify this on my end with a custom crypto provider but I am running into some issues. Here is the snippet of code that I am trying to get working. And im getting the following error, what am I doing wrong here? I've also noticed on the Please forgive my new-ness to rust but would this be the cause of the error? Or is there something wrong with the configuration on my end? Appreciate the help here! |
|
@nnmkhang It's still a PR let provider = Arc::new(default_symcrypt_provider());
ClientConfig::builder_with_provider(provider.clone())
.with_safe_default_protocol_versions()
.unwrap()
.dangerous()
.with_custom_certificate_verifier(Arc::new(Verifier::new().with_provider(provider)))
.with_no_client_auth()Note the The awkwardness of this construction motivates #86, which that code was directly taken from Alternatively, if you wanted to use let provider = Arc::new(default_symcrypt_provider());
let mut verifier = Verifier::new();
verifier.set_provider(provider.clone());
ClientConfig::builder_with_provider(provider)
.with_safe_default_protocol_versions()
.unwrap()
.dangerous()
.with_custom_certificate_verifier(Arc::new(verifier))
.with_no_client_auth() |
complexspaces
left a comment
There was a problem hiding this comment.
Thanks for working through this with us! I think this is looking quite nice now.
|
@jbr, Just tried it again on my my machine and it works with the custom provider and the platform verifier enabled! Verified with event viewer on windows as well. Thanks for your help and sorry for my silly mistake. |
|
Sounds good to me. |
|
v/0.3.1 is now available with this change included. |
This is offered as a possible solution for #79, which I just encountered.
Implementation notes, let me know if any of these assumptions were wrong:
default_providerfields tocrypto_providerto make clear that it's not necessarily the process-default.set_providerandwith_provider, the latter of which is convenient forVerifier::new().with_provider(Arc::new(...))but I'll replace withVerifier::new_with_provider(...)if that's more in line with this crate's style.I opted to panic if the crypto provider has already been set instead of returning an indication of failure, with the expectation that it's a bug if this is called multiple times on a givenWe haveVerifier.&mut, no panic or error needed